<template>
  <div>{{ cValue }}</div>
</template>
<script setup lang="ts">
  import { computed } from 'vue';

  const props = defineProps({
    value: {
      type: [String, Boolean, Number, Array],
      default: undefined,
    },
    options: {
      type: Array,
      default: () => [],
    },
  });
  const cValue = computed(() => {
    if (props.value instanceof Array) {
      return props.options
        .filter((item: any) => (props.value as Array<any>).includes(item.value))
        .map((item: any) => item.label)
        .join(',');
    } else {
      return (
        props.options.find((item: any) => item.value?.toString() === props.value?.toString()) as any
      )?.label;
    }
  });
</script>
<style lang="less" scoped></style>
